package com.example.higo.view.fragment.maishou;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.higo.R;
import com.example.higo.api.service.ExceptionHandle;
import com.example.higo.model.entity.maishou.MaishouBody;
import com.example.higo.model.entity.maishou.MaishouTab;
import com.example.higo.persenter.maishou.MaishouPersenter;
import com.example.higo.view.fragment.BaseFragment;
import com.example.higo.view.imp.maishou.MaishouView;

import java.util.HashMap;
import java.util.Map;

/**
 * A simple {@link Fragment} subclass.
 */
public class MaishouFragment extends BaseFragment implements MaishouView{

    private MaishouPersenter persenter;
    private String page = "1";
    private String id = "66";


    public static MaishouFragment newInstance() {
        
        Bundle args = new Bundle();
        
        MaishouFragment fragment = new MaishouFragment();
        fragment.setArguments(args);
        return fragment;
    }
    @Override
    public int getLayout() {
        return R.layout.fragment_maishou;
    }

    @Override
    public void initViews() {
         persenter = new MaishouPersenter(this);
    }

    @Override
    public void loadData() {
        persenter.getMaishouTabData();
        persenter.getMaishouBodyData(getMap());
    }

    private Map<String,String> getMap(){
        Map<String,String> map  = new HashMap<>();
        map.put("p",page);
        map.put("id",id);
        return map;
    }

    @Override
    public void onSuccessTab(MaishouTab maishouTab) {

    }

    @Override
    public void onSuccessBody(MaishouBody maishouBody) {

    }

    @Override
    public void onFinish() {

    }

    @Override
    public void onFail(ExceptionHandle.ResponeThrowable e) {
        System.out.println(e.message);
    }
}
